/* Destructor function for tx skbs. */
static void tx_skb_release(struct sk_buff *skb)
{
- int i;
+ int i, send = 0;
net_vif_t *vif = sys_vif_list[skb->src_vif];
unsigned int idx;
tx_shadow_entry_t *tx;
+ unsigned long cpu_mask;
for ( i = 0; i < skb_shinfo(skb)->nr_frags; i++ )
put_page_tot(skb_shinfo(skb)->frags[i].page);
if ( idx == vif->shadow_ring->tx_idx ) BUG();
tx = &vif->shadow_ring->tx_ring[idx];
vif->shadow_ring->tx_cons = TX_RING_INC(idx);
- if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event )
- set_bit(_EVENT_NET_TX,
- &sys_vif_list[skb->src_vif]->domain->shared_info->events);
+ if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event ) send = 1;
} while ( tx->status != RING_STATUS_OK );
/* Now skip over any more bad descriptors, up to the next good one. */
(tx->status == RING_STATUS_OK) )
break;
vif->shadow_ring->tx_cons = TX_RING_INC(idx);
- if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event )
- set_bit(_EVENT_NET_TX,
- &sys_vif_list[skb->src_vif]->domain->shared_info->events);
+ if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event ) send = 1;
} while ( 1 );
- /* Finally, update shared consumer index to the new private value. */
+ /* Update shared consumer index to the new private value. */
vif->net_ring->tx_cons = vif->shadow_ring->tx_cons;
+
+ /* Send a transmit event if requested. */
+ if ( send )
+ {
+ cpu_mask = mark_guest_event(
+ sys_vif_list[skb->src_vif]->domain, _EVENT_NET_TX);
+ guest_event_notify(cpu_mask);
+ }
}
#include <asm/io.h>
#include <net/sock.h>
+#include <net/pkt_sched.h>
#define NET_TX_IRQ _EVENT_NET_TX
#define NET_RX_IRQ _EVENT_NET_RX
np->tx_idx = i;
/* Set a new event, then check for race with update of tx_cons. */
- np->net_ring->tx_event = TX_RING_INC(cons);
+ np->net_ring->tx_event =
+ TX_RING_ADD(cons, (atomic_read(&np->tx_entries)>>1) + 1);
smp_mb();
}
while ( cons != np->net_ring->tx_cons );